package com.XinYun.Library.modules.admin.common;

import cn.hutool.json.JSONUtil;
import com.XinYun.Library.modules.commons.BasicJson;
import com.XinYun.Library.modules.commons.ReturnCodes.ReturnCodes;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class BasicService {
    protected void setMsgCode(BasicJson json, ReturnCodes rc){
        json.setCode(rc.getCode());
        json.setMsg(rc.getMsg());
    }

    protected String fuzzy(String keyword){
        StringBuilder keywords = new StringBuilder();
        for (int i = 0; i < keyword.length(); i++) {
            keywords.append('%');
            keywords.append(keyword.charAt(i));
        }
        keywords.append('%');
        return keywords.toString();
    }
}
